14. Transforming Text

Transforming Text

Geometric transformations

To transform any 2D image, you can create a mathematical mapping that rotates, shifts, and stretches points into a desired shape. This mapping is calculated by OpenCV and applied using an 3x3 perspective transformation matrix, which you can learn more about, here. This matrix transforms the appearance of points but preserves straight lines that define an image plane.

Applying the transform

To create and apply this transformation, we used OpenCV's getPerspectiveTransform and warpPerspective functions, which are documented, here.